<?php
class packing_list_report extends CActiveRecord {
/**
 * The followings are the available columns in table 'packing_list_detail':
 * @var integer $id
 * @var integer $shipping_id
 * @var integer $date
 * @var string $subject
 * @var string $ref_no
 * @var string $pod
 */

/**
 * Returns the static model of the specified AR class.
 * @return CActiveRecord the static model class
 */

    public $do = array();
    public static function model($className=__CLASS__) {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return 'packing_list_report';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules() {
    // NOTE: you should only define rules for those attributes that
    // will receive user inputs.
        return array(
            array('attn_id, fm_id, packing_list_id', 'required'),
            array('attn_id, fm_id, packing_list_id', 'numerical', 'integerOnly'=>true),
            array('subject, remark', 'length', 'max'=>254),
            array('name', 'length', 'max'=>50),
            array('date','type','type'=>'date','dateFormat'=>'dd/MM/yyyy'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations() {
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
        return array(
            'cargo'=>array(self::HAS_MANY,'packing_list_report_cargo','packing_list_report_id'),
            'packing_list'=>array(self::BELONGS_TO,'packing_list','packing_list_id'),
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'attn_id' => 'Attn',
            'remark' => 'Remark',
            'subject' => 'Subject',
            'date' => 'Date',
            'name' => 'Report Name'
        );
    }
}